package infoserver;

import javax.swing.JFrame;

/**
 * Dit is de main class waar alle objecten aangemaakt worden
 * @author Erik Uitenbroek, Michael Stevens
 * @since 26-04-2012
 */
public class Infoserver {
    private SqlConnection msSql;
    private GUI g;
    private InfoServerSocket iss;
    private Login login;
    private Settings settings;
    private Log log;
    
    public Infoserver(){
        // maak databaseverbinding aan
        msSql = new SqlConnection(this);
        
        // maak login object aan
        login = new Login(this);
        
        //maak serversocket aan
        iss = new InfoServerSocket(this);
        
        //maak GUI aan
        g = new GUI(this);
        g.setVisible(true);
        g.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        settings = new Settings(this);
        settings.readSettings(g);
        g.setStatusInfo();
        settings.getPath();
      
        log = new Log(settings.getPath());
        log.createDir();
        log.createLog();       
        
        g.addElements(settings.getPath());
        g.writeLog("Log file succesfully created");
    }
    
    /**     
    * @return the object sqlConnection   
    */
    public SqlConnection getSql(){
        return msSql;
    }
    
    /**    
    * @return the object GUI    
    */
    public GUI getGui(){
        return g;
    }
    
    /**    
    * @return the object InfoServerSocket    
    */
    public InfoServerSocket getIss() {
        return iss;
    }   

    /**
     * @return the login
     */
    public Login getLogin() {
        return login;
    }
    
     public static void main(String[] args) {
        Infoserver i = new Infoserver();        
    }

    /**
     * @return the settings
     */
    public Settings getSettings() {
        return settings;
    }

    /**
     * @return the log
     */
    public Log getLog() {
        return log;
    }

    
}
